/*
 Copyright (C) 2010 QDSS.org
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.qdss.bizz.security.member;

import java.io.Serializable;
import java.security.Principal;

/**
 * 团队
 * 
 * @author <a href="mailto:zhaofang123@gmail.com">Zhao Fangfang</a>
 * @since 0.2, 2010-10-4
 * @version $Id: Team.java 7 2011-05-15 16:40:50Z zhaofang123@gmail.com $
 */
public class Team extends MemberGroup {
	private static final long serialVersionUID = 1557485019536221272L;

	/**
	 * @param identity
	 * @param name
	 * @param disabled
	 */
	public Team(Serializable identity, String name, boolean disabled) {
		super(identity, name, disabled);
	}

	@Override
	public boolean addMember(Principal user) {
		if (!super.addMember(user))
			return false;
		((User) user).joinTeam(this);
		return true;
	}

	@Override
	public boolean removeMember(Principal user) {
		if (!super.removeMember(user))
			return false;
		((User) user).exitTeam(this);
		return true;
	}
}
